<?php
/**
 * Created by PhpStorm.
 * User: MI
 * Date: 2019/2/12
 * Time: 15:38
 */

namespace App\Http\Controllers\Site;
use App\Http\Controllers\Controller;
use App\Models\CMS\Content;

class SiteController extends Controller
{
    /**
     * @return \Illuminate\Contracts\View\Factory|\Illuminate\View\View
     */
    public function index()
    {
        return view('web.index');
    }

    /**
     * @return \Illuminate\Contracts\View\Factory|\Illuminate\View\View
     */
    public function guide(){
        return view('web.guide');
    }

    /**
     * @return \Illuminate\Contracts\View\Factory|\Illuminate\View\View
     */
    public function service(){
        $query = Content::query()
            ->where('content_detail_type', 'ContentBlog')
            ->orderByDesc('id')
            ->whereHas('category', function ($query) {
                $query->where('name', '网上服务');
            });
        $contents = $query->paginate(1);
        return view('web.service', [
            'contents' => $contents,
        ]);
    }

    /**
     * @return \Illuminate\Contracts\View\Factory|\Illuminate\View\View
     */
    public function notice(){
        $query = Content::query()
            ->where('content_detail_type', 'ContentBlog')
            ->orderByDesc('id')
            ->whereHas('category', function ($query) {
                $query->where('name', '新闻公告');
            });
        $contents = $query->get();
        return view('web.notice', [
            'contents' => $contents,
        ]);
    }

    /**
     * @return \Illuminate\Contracts\View\Factory|\Illuminate\View\View
     */
    public function contact(){
        return view('web.contact');
    }


}
